require 'watir'
include Watir
require 'test/unit'
class TC_blogsFrontEnd < Test::Unit::TestCase
  	def test_42_ModifyBlogURLUsingTextBoxes_Blogs

  $ie.goto($UniVar)

#Create Blog
	$ie.goto($UniVar + '/controlpanel/BlogAdmin/sectionedit.aspx')	
	$ie.text_field(:id, /ctl00_ctl00_TaskRegion_SectionDetails1_SectionDetails1_SectionName/).set('rewriteblog')
	$ie.text_field(:id, /ctl00_ctl00_TaskRegion_SectionDetails1_SectionDetails1_AppKey/).set('rewriteblog')
	$ie.link(:text, 'Save').click

#Test Specifics
	$ie.goto($UniVar + '/controlpanel/BlogAdmin/Groups.aspx')		

  $ie.link(:index, 21).click
	$ie.link(:text, 'rewriteblog').click
	$ie.text_field(:id, /ctl00_ctl00_TaskRegion_SectionDetails1_SectionDetails1_SectionName/).clear
	$ie.text_field(:id, /ctl00_ctl00_TaskRegion_SectionDetails1_SectionDetails1_SectionName/).set('watir blog')
	$ie.link(:text, 'Save').click
	assert($ie.contains_text('watir blog'))

  #Delete Blog      
  $ie.goto($UniVar + '/controlpanel/BlogAdmin/Blogs.aspx')
  $ie.wait()
  $ie.link(:text, 'Delete').click_no_wait
  hwnd = $ie.enabled_popup(20)
    if(hwnd)
      w = WinClicker.new
      w.clickWindowsButton_hwnd(hwnd, "OK")
    end  
	end
end